
using System;
using System.Collections.Generic;
using System.Text;
using NFinal.Extension;

namespace WebApplication1.DDD.Models.Entity.Common
{
    public struct user_group:NFinal.IModel
    {
		public System.Int64 id;
		public System.String title;
		public System.Int64? grade;
		public System.Int64? upgrade_exp;
		public System.Int64? amount;
		public System.Int64? point;
		public System.Double? discount;
		public System.Int16? is_default;
		public System.Int16? is_upgrade;
		public System.Int16? is_lock;
		#region Nullable
		private bool __is_null__;
        public bool __Is_Null__
        {
            get {
                return __is_null__;
            }
            set
            {
                 __is_null__=value;
            }
        }
        public static implicit operator user_group(string __value__)
        {
            var __value2__ = new user_group();
            __value2__.__Is_Null__ = __value__==null;
            return __value2__;
        }
        public static  bool operator true(user_group __value__)
        {
            return !__value__.__is_null__;
        }
        public static bool operator false(user_group __value__)
        {
            return !__value__.__is_null__;
        }
		#endregion
		#region 从get列表初始化实体类
		public static bool TryParse(NFinal.NameValueCollection get,out user_group par)
		{
			par=new user_group();
			try
			{
						System.Int64.TryParse(get["id"],out par.id);
						par.title=get["title"];
						par.grade=null;
						if(get["grade"]!=null)
						{
							par.grade=get["grade"].AsVar();
						}
						par.upgrade_exp=null;
						if(get["upgrade_exp"]!=null)
						{
							par.upgrade_exp=get["upgrade_exp"].AsVar();
						}
						par.amount=null;
						if(get["amount"]!=null)
						{
							par.amount=get["amount"].AsVar();
						}
						par.point=null;
						if(get["point"]!=null)
						{
							par.point=get["point"].AsVar();
						}
						par.discount=null;
						if(get["discount"]!=null)
						{
							par.discount=get["discount"].AsVar();
						}
						par.is_default=null;
						if(get["is_default"]!=null)
						{
							par.is_default=get["is_default"].AsVar();
						}
						par.is_upgrade=null;
						if(get["is_upgrade"]!=null)
						{
							par.is_upgrade=get["is_upgrade"].AsVar();
						}
						par.is_lock=null;
						if(get["is_lock"]!=null)
						{
							par.is_lock=get["is_lock"].AsVar();
						}
			}
			catch
			{
				return false;
			}
			return true;
		}
		#endregion
		#region 写Json字符串
		public void WriteJson(System.IO.TextWriter tw)
		{
			tw.Write("{");
					tw.Write("\"id\":");
					tw.Write(id.ToString());
					tw.Write(",");
					tw.Write("\"title\":");
					tw.Write("\"");
					tw.Write(title==null?"null":title);
					tw.Write("\"");
					tw.Write(",");
					tw.Write("\"grade\":");
					tw.Write(grade==null?"null" : grade.ToString());
					tw.Write(",");
					tw.Write("\"upgrade_exp\":");
					tw.Write(upgrade_exp==null?"null" : upgrade_exp.ToString());
					tw.Write(",");
					tw.Write("\"amount\":");
					tw.Write(amount==null?"null" : amount.ToString());
					tw.Write(",");
					tw.Write("\"point\":");
					tw.Write(point==null?"null" : point.ToString());
					tw.Write(",");
					tw.Write("\"discount\":");
					tw.Write(discount==null?"null" : discount.ToString());
					tw.Write(",");
					tw.Write("\"is_default\":");
					tw.Write(is_default==null?"null" : is_default.ToString());
					tw.Write(",");
					tw.Write("\"is_upgrade\":");
					tw.Write(is_upgrade==null?"null" : is_upgrade.ToString());
					tw.Write(",");
					tw.Write("\"is_lock\":");
					tw.Write(is_lock==null?"null" : is_lock.ToString());

			tw.Write("}");
		}
		#endregion
    }
}
